<?
define("D_PORTAL", $_SERVER['DOCUMENT_ROOT']);
define("U_MOD", 1);

require_once D_PORTAL.'/inc/core.php';

$avialable_langs = explode(",", $option['avialable_langs']);

if (isset($lang) && !empty($lang))
{
	if (in_array($lang, $avialable_langs))
	{
		$query = "SHOW TABLES FROM ".$dbname." LIKE '".$PortalPref."langs_".$lang."'";
		$result = mysql_query($query);

		if ($result && mysql_num_rows($result)==1)
			$_SESSION['u_lang']=$lang;
	}
}

if (isset($theme) && !empty($theme))
{
	if (file_exists(D_PORTAL.'/theme/'.$theme.'/template.php'))
		$_SESSION['u_theme']=$theme;
}

$reffer_url=getRefferUrl($_SERVER['HTTP_REFERER'], $portal_url);
echo"<meta http-equiv='refresh' content='0;url=".$reffer_url."'>";

?>